/*
 * InputFrameListener.cpp
 *
 *  Created on: 05.05.2009
 *      Author: markus
 */

#include "CInputFrameListener.h"

CInputFrameListener::CInputFrameListener(/*std::string strPar1, std::string strPar2, */CLivingObject *player, KeyMapping *keyMapping) : CSDLInputHandler(player, keyMapping)//COisBufferedInputHandler(strPar1, strPar2, player, )
{
	writeDebugOutput("CInputFrameListener::CInputFrameListener(): frame listener is going alive!");
//	m_pKeyboard = NULL;
	m_lFrame = 0;

}

CInputFrameListener::~CInputFrameListener()
{
	writeDebugOutput("CInputFrameListener::CInputFrameListener(): frame listener is dying!");
}

bool CInputFrameListener::frameStarted(const FrameEvent& evt)
{
// Do not uncomment this next one if you do not need it - it is called EVERY FRAME!!!!
//	writeDebugOutput("CInputFrameListener::frameStarted(): looking for input.");
	//if(m_pKeyboard)
	//{
	//	// Do not uncomment this next one if you do not need it - it is called EVERY FRAME!!!!
	//	// writeDebugOutput("CInputFrameListener::frameStarted(): checking for KeyboardInput");
	//	m_pKeyboard->capture();
	//}
	//if(m_pMouse)
	//{
	//	m_pMouse->capture();
	//}

	checkEvents();

	m_pPlayer->getSceneNode()->translate(m_pPlayer->getSprintMove() * *(m_pPlayer->getv3Position()) * evt.timeSinceLastFrame, Ogre::Node::TS_LOCAL );

	return m_bContinue;
}
